/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.dao.db;

import java.io.Serializable;
import com.baidu.bjf.remoting.protobuf.Codec;
import com.baidu.bjf.remoting.protobuf.ProtobufProxy;
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
import com.jili.ubert.code.CodeTool;
import java.io.IOException;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dragon
 */
@Entity
@Table(name = "work_productflow")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "WorkProductFlow.findAll", query = "SELECT w FROM WorkProductFlow w"),
    @NamedQuery(name = "WorkProductFlow.findById", query = "SELECT w FROM WorkProductFlow w WHERE w.id = :id"),
    @NamedQuery(name = "WorkProductFlow.findByProductID", query = "SELECT w FROM WorkProductFlow w WHERE w.productID = :productID"),
    @NamedQuery(name = "WorkProductFlow.findByAnchorCode", query = "SELECT w FROM WorkProductFlow w WHERE w.anchorCode = :anchorCode"),
    @NamedQuery(name = "WorkProductFlow.findByFlowSeqNo", query = "SELECT w FROM WorkProductFlow w WHERE w.flowSeqNo = :flowSeqNo"),
    @NamedQuery(name = "WorkProductFlow.findByUserID", query = "SELECT w FROM WorkProductFlow w WHERE w.userID = :userID"),
    @NamedQuery(name = "WorkProductFlow.findByRoleID", query = "SELECT w FROM WorkProductFlow w WHERE w.roleID = :roleID"),
    @NamedQuery(name = "WorkProductFlow.findByBlongGroupID", query = "SELECT w FROM WorkProductFlow w WHERE w.blongGroupID = :blongGroupID"),
    @NamedQuery(name = "WorkProductFlow.findByReMark", query = "SELECT w FROM WorkProductFlow w WHERE w.reMark = :reMark"),
    @NamedQuery(name = "WorkProductFlow.findByOwnUserID", query = "SELECT w FROM WorkProductFlow w WHERE w.ownUserID = :ownUserID"),
    @NamedQuery(name = "WorkProductFlow.findByAlterUserID", query = "SELECT w FROM WorkProductFlow w WHERE w.alterUserID = :alterUserID"),
    @NamedQuery(name = "WorkProductFlow.findByCreateTime", query = "SELECT w FROM WorkProductFlow w WHERE w.createTime = :createTime"),
    @NamedQuery(name = "WorkProductFlow.findByTimeStamp", query = "SELECT w FROM WorkProductFlow w WHERE w.timeStamp = :timeStamp")})
public class WorkProductFlow implements Serializable {
	public static byte[] EnCode(WorkProductFlow msg) throws IOException {
		Codec<WorkProductFlow> Lcode = ProtobufProxy.create(WorkProductFlow.class);
		return Lcode.encode(msg);
	}
	public static WorkProductFlow DeCode(byte[] data) throws IOException {
	Codec<WorkProductFlow> Lcode = ProtobufProxy.create(WorkProductFlow.class);
		return Lcode.decode(data);
	}

    private static final long serialVersionUID = 1L;
    @Id
    //@GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    @Protobuf
	private Integer id;
    @Basic(optional = false)
    @Column(name = "ProductID")
    @Protobuf
	private int productID;
    @Basic(optional = false)
    @Column(name = "AnchorCode")
    @Protobuf
	private String anchorCode;
    @Basic(optional = false)
    @Column(name = "FlowSeqNo")
    @Protobuf
	private int flowSeqNo;
    @Basic(optional = false)
    @Column(name = "UserID")
    @Protobuf
	private String userID;
    @Basic(optional = false)
    @Column(name = "RoleID")
    @Protobuf
	private String roleID;
    @Basic(optional = false)
    @Column(name = "BlongGroupID")
    @Protobuf
	private int blongGroupID;
    @Column(name = "ReMark")
    private String reMark;
	@Protobuf
	private byte[] reMarkBit;
    @Column(name = "OwnUserID")
    @Protobuf
	private String ownUserID;
    @Column(name = "AlterUserID")
    @Protobuf
	private String alterUserID;
    @Column(name = "CreateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
	//@Protobuf
//tprivate long createTimeL;
    @Column(name = "TimeStamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timeStamp;
	//@Protobuf
	//private long timeStampL;

    public WorkProductFlow() {
    }

    public WorkProductFlow(Integer id) {
        this.id = id;
    }

    public WorkProductFlow(Integer id, int productID, String anchorCode, int flowSeqNo, String userID, String roleID, int blongGroupID) {
        this.id = id;
        this.productID = productID;
        this.anchorCode = anchorCode;
        this.flowSeqNo = flowSeqNo;
        this.userID = userID;
        this.roleID = roleID;
        this.blongGroupID = blongGroupID;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public int getProductID() {
        return productID;
    }

    public void setProductID(int productID) {
        this.productID = productID;
    }

    public String getAnchorCode() {
        return anchorCode;
    }

    public void setAnchorCode(String anchorCode) {
        this.anchorCode = anchorCode;
    }

    public int getFlowSeqNo() {
        return flowSeqNo;
    }

    public void setFlowSeqNo(int flowSeqNo) {
        this.flowSeqNo = flowSeqNo;
    }

    public String getUserID() {
        return userID;
    }

    public void setUserID(String userID) {
        this.userID = userID;
    }

    public String getRoleID() {
        return roleID;
    }

    public void setRoleID(String roleID) {
        this.roleID = roleID;
    }

    public int getBlongGroupID() {
        return blongGroupID;
    }

    public void setBlongGroupID(int blongGroupID) {
        this.blongGroupID = blongGroupID;
    }

    public String getReMark() {
        return reMark;
    }

    public void setReMark(String reMark) {
        this.reMark = reMark;
        this.setReMarkBit(CodeTool.StringToBit(reMark));
    }

    public String getOwnUserID() {
        return ownUserID;
    }

    public void setOwnUserID(String ownUserID) {
        this.ownUserID = ownUserID;
    }

    public String getAlterUserID() {
        return alterUserID;
    }

    public void setAlterUserID(String alterUserID) {
        this.alterUserID = alterUserID;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
		//this.createTimeL = CodeTool.DateToLong(createTime);
    }

    public Date getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(Date timeStamp) {
        this.timeStamp = timeStamp;
		//this.timeStampL = CodeTool.DateToLong(timeStamp);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof WorkProductFlow)) {
            return false;
        }
        WorkProductFlow other = (WorkProductFlow) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jili.ubert.dao.db.WorkProductFlow[ id=" + id + " ]";
    }

    public byte[] getReMarkBit() {
        return reMarkBit;
    }

    public void setReMarkBit(byte[] reMarkBit) {
        this.reMarkBit = reMarkBit;
		this.reMark = CodeTool.BitToString(reMarkBit);
    }
    
}
